<%--
  Copyright (c) 2024,  科泰集团教研团队
  版权所有，请勿侵权
  author: 科泰集团教研团队
  createTime: 2024/4/10 16:52
  lastModify: 2024/4/10 16:52
  version 1.0.0
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>科泰超市管理系统</title>
    <%--  导入公共头部信息  --%>
    <%@include file="/WEB-INF/layout/head.jsp" %>
    <%--  有其他css样式可以在这里引入或编写  --%>
</head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">
        <!-- 引入左边导航菜单 -->
        <jsp:include page="/WEB-INF/layout/left-nav.jsp"></jsp:include>
        <!-- 引入左边导航菜单 -->

        <!-- 引入顶部导航 -->
        <jsp:include page="/WEB-INF/layout/top-nav.jsp"></jsp:include>
        <!-- 引入顶部导航 -->

        <!-- 内容部分，需自己设计 -->
        <div class="right_col">
            <div class="">
                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>查询入库单列表</h2>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">
                                <form id="search-form" action="${ctx}/main/storageRecord/page" method="post"
                                      data-parsley-validate class="form-inline">
                                    <input type="hidden" name="pageNo" value="${pageInfo.pageNo}"/>
                                    <input type="hidden" name="pageSize" value="${pageInfo.pageSize}">
                                    <div class="form-group col-md-3 col-sm-3 col-xs-12">
                                        <label class="control-label text-center col-md-4 col-sm-4 col-xs-12"
                                               for="goodsName">商品名称 </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input type="text" id="goodsName" name="goodsName"
                                                   value="${condition.goodsName}"
                                                   class="form-control">
                                        </div>
                                    </div>
                                    <div class="form-group col-md-3 col-sm-3 col-xs-12">
                                        <label class="control-label text-center col-md-4 col-sm-4 col-xs-12"
                                               for="supplierId">供应商 </label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <select id="supplierId" name="supplierId" class="form-control">
                                                <option value="">--------------- 全部 ---------------</option>
                                                <c:forEach items="${supplierList}" var="supplier">
                                                    <option value="${supplier.id}"
                                                        ${supplier.id == condition.supplierId ? "selected='selected'" : ""}>${supplier.supName}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-3 col-sm-3 col-xs-12">
                                        <label class="control-label text-center col-md-4 col-sm-4 col-xs-12"
                                               for="supplierId">&nbsp;&nbsp;&nbsp; 付款状态</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <select id="payStatus" name="payStatus" class="form-control">
                                                <option value="">--------------- 全部 ---------------</option>
                                                <option value="1" ${ 1 == condition.payStatus ? "selected='selected'" : ""}>
                                                    未支付
                                                </option>
                                                <option value="2" ${ 2 == condition.payStatus ? "selected='selected'" : ""}>
                                                    已支付
                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-3 col-sm-3 col-xs-12">
                                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                                            <button type="submit" id="search-btn" class="btn btn-success">查询</button>
                                            <button type="button"
                                                    onclick="$(this).closest('form').find(':input').val('')"
                                                    id="reset-btn" class="btn btn-warning">重置
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_content">
                                <p class="text-muted font-13 m-b-30">
                                    <button type="button" id="add-btn" class="btn btn-success">添加</button>
                                </p>
                                <div class="table-responsive">
                                    <table id="datatable-checkbox"
                                           class="table table-striped table-bordered jambo_table bulk_action">
                                        <thead>
                                        <tr class="headings">
                                            <%--                                                        <th>--%>
                                            <%--                                                            <input type="checkbox" id="check-all" class="flat">--%>
                                            <%--                                                        </th>--%>
                                            <th class="column-title">入库单编号</th>
                                            <th class="column-title">商品名称</th>
                                            <th class="column-title">金额</th>
                                            <th class="column-title">供应商</th>
                                            <th class="column-title">付款状态</th>
                                            <th class="column-title">创建时间</th>
                                            <th class="column-titl no-link last" width="160px"><span
                                                    class="nobr">操作</span></th>
                                            <th class="bulk-actions" colspan="8">
                                                <a class="antoo" style="color:#fff; font-weight:500;">批量操作 ( <span
                                                        class="action-cnt"> </span> ) <i class="fa fa-chevron-down"></i></a>
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <c:forEach items="${pageInfo.data}" var="storageRecord">
                                            <tr>
                                                    <%--                                                            <td class="a-center ">--%>
                                                    <%--                                                                <input type="checkbox" class="flat" name="table_records">--%>
                                                    <%--                                                            </td>--%>
                                                <td class=" ">${storageRecord.srCode}</td>
                                                <td class=" ">${storageRecord.goodsName}</td>
                                                    <%--    计算单价--%>
                                                <td class=" ">
                                                    <fmt:formatNumber
                                                            value="${storageRecord.totalAmount / storageRecord.goodsCount}"
                                                            pattern="#,##0.00"/>
                                                </td>
                                                <td class=" ">${storageRecord.supplier.supName}</td>
                                                <td class=" ">${storageRecord.payStatus == 1 ? '未支付' : '已支付'}</td>
                                                <td class=" "><fmt:formatDate value="${storageRecord.createdTime}"
                                                                              pattern="yyyy-MM-dd"></fmt:formatDate></td>
                                                <td class=" last">
                                                    <button onclick="view(${storageRecord.id})"
                                                            data-original-title="查看" class="btn btn-sm btn-default"
                                                            type="button" data-placement="top" data-toggle="tooltip"><i
                                                            class="fa fa-eye"></i></button>
                                                    <button onclick="edit(${storageRecord.id})"
                                                            data-original-title="修改" class="btn btn-sm btn-default"
                                                            type="button" data-placement="top" data-toggle="tooltip"><i
                                                            class="fa fa-edit"></i></button>
                                                    <button onclick="del(${storageRecord.id},'${storageRecord.srCode}')"
                                                            data-original-title="删除" class="btn btn-sm btn-default"
                                                            type="button" data-placement="top" data-toggle="tooltip"><i
                                                            class="fa fa-trash-o"></i></button>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                        </tbody>
                                    </table>
                                </div>
                                <%-- 传递参数将查询form的id传给分页组件  --%>
                                <c:import url="/WEB-INF/layout/common/pagination.jsp">
                                    <c:param name="formId" value="search-form"></c:param>
                                </c:import>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 内容部分，需自己设计 -->

        <!-- 底部内容 -->
        <jsp:include page="/WEB-INF/layout/footer.jsp"></jsp:include>
        <!-- 底部内容 -->

        <%-- 引入自己的JS代码 --%>
        <script src="${ctx}/statics/js/storageRecord/page.js"></script>
    </div>
</div>
</body>
</html>
